// components/title-bar/title-bar.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    statusBarHeight: 0, // 状态栏高度
    navigationBarHeight: 0, // 导航栏高度
    gap: 0, // 导航栏与状态栏间的间距
  },
  ready() {
    const { top, height } = wx.getMenuButtonBoundingClientRect()
    const statusBarHeight = wx.getSystemInfoSync().statusBarHeight
    const gap = top - statusBarHeight
    let navigationBarHeight = gap * 2 + height
    this.setData({
      statusBarHeight,
      navigationBarHeight,
      gap
    })
  },
  /**
   * 组件的方法列表
   */
  methods: {
    handleBackClick() {
      wx.navigateBack()
    }
  }
})